package mr.aurelien.blackboard.model;
/*
 * Class that represent a point in a time line
 */
public class Point {
	/*
	 * X coordinate
	 */
	private float x=0;
	/*
	 * Y coordinate
	 */
	private float y=0;
	/*
	 * Time stamp for the point
	 */
	long time = 0;
	/*
	 * Constructor
	 */
	public Point(float x2, float y2) {
		setX(x2);
		setY(y2);
	}
	/*
	 * Constructor
	 */
	public Point(float x2, float y2, long delay) {
		setX(x2);
		setY(y2);
		time=delay;
	}
	/*
	 * Output object to "X,Y - time" format  
	 */
	@Override
    public String toString() {
        return getX() + "," + getY() + " - " + time;
    }
	/*
	 * Get x coordinate of the point
	 */
	public float getX() {
		return x;
	}
	/*
	 * Set x coordinate of the point
	 */
	public void setX(float x) {
		this.x = x;
	}
	/*
	 * Get y coordinate of the point
	 */
	public float getY() {
		return y;
	}
	/*
	 * Set y coordinate of the point
	 */
	public void setY(float y) {
		this.y = y;
	}
	/*
	 * Export object to JSON format. Manual implementation
	 */
	@Deprecated
	public String toJSON(){
		String json = "";
		json += "{";
		json += "\"x\":\""+ this.x +"\"";
		json += ",";
		json += "\"y\":\""+ this.y +"\"";
		json += ",";
		json += "\"time\":\""+ this.time +"\"";
		json += "}";
		return json;
	}
}
